<%= link_to 'Node List', nodes_path %>
<%= link_to 'Task List', tasks_path %>
<%= link_to 'Node Type List', node_types_path %>
<%= link_to 'Phase Type List', phase_types_path %>
<br/>
<p>
  <% if @node.parent != nil %>
    <% if @node.parent.parent != nil %>
      <%= link_to Node.find(@node.parent.parent).name , @node.parent.parent %> >
    <% end %>
    <%= link_to Node.find(@node.parent).name , @node.parent %>
  <% end %>
</p>
<strong> <%= @node.name %></strong> [<%= @node.nodeType.name %>]
<%= link_to 'Edit', edit_node_path(@node) %>
<br/>
<%= simple_format(@node.description) %>
<br/>
</p>
  
<strong>Comprised of:</strong>  
    <ul>
      <% if @node.children.count > 0 %>
        <% @node.children.each do |child| %>
          <li>
            <%= link_to ("[" + child.nodeType.name + "] " + child.name) , child %>
          </li>
        <% end %>
        <br/>
      <% end %> 
          <%= link_to 'Add New Node' , new_node_path(@node) %>      
    </ul>
 
  <% if true %>
  <br/><br/><br/>

<strong>Phases:</strong> <%= link_to 'Add' , new_phase_path(@node) %> <br/> 
<% if @nodePhases.count > 0 %>
<table cellpadding="10" border="1">
  <tr>

        <% @nodePhases.each do |phase| %>
          <td><%= phase.type %> <%= link_to 'Mark as Done', edit_phase_path(phase) %>
          <ul>
            <% @tasks = Task.where(:phase_id => phase) %>
            <% if @tasks.count > 0 %>
              <% @tasks.each do |task| %>
                <li>
                  <%= task.name %>
                </li>
               <% end %>
            <% end %>
          <%= link_to 'Add Task' , new_task_path(phase) %>  <br/>
          </ul>
          <br/>
          Depends on:<br/>
        
          <%= link_to "Add Dependency" , new_dependable_path(:phase_id => phase) %>
         
        </td>
        <% end %>

      <br/>
             
    
  </tr>
</table>   
<% end %>    
<br/><br/>

<strong>Has Questions:</strong> <%= link_to 'Add' , new_question_path(@node) %> <br/>
<% if @nodeQuestions.count > 0 %>
  <ul>
    <% @nodeQuestions.each do |question| %>
      <li>
        <%= question.question %>
      </li>
    <% end %>
  </ul>
<% end %> 
<br/><br/>
<br/>

<% end %>

